import axios from '@/utils/axios'

export const getDict = (id: string): Promise<ApiResult<SystemDictPO>> => {
  return axios.get(`system/dict/${id}`)
}

export const getDictPage = (
  pagination: Pagination,
  params: SystemDictPO
): Promise<ApiResult<Page<SystemDictVO>>> => {
  return axios.get(`system/dict/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const postOrPutDict = (data: SystemDictPO): Promise<ApiResult<null>> => {
  return axios.post(`system/dict`, data)
}

export const deleteDict = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`system/dict/${id}`)
}
